<!DOCTYPE html>
<html lang="en">
<head>
    <title>京伦内容管理系统</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="__PUBLIC__/bootstrap/css/bootstrap.min.css" />
    <load href="__PUBLIC__/bootstrap/js/jquery.min.js" />
    <load href="__PUBLIC__/bootstrap/js/bootstrap.min.js" />
</head>
<body>

<!-- header -->
<include file="Public:header" />



<div class="row">
    <!-- left -->

    <include file="Content:left" />

    <div class="col-md-8" style="padding-top: 70px;">
        <div class="container">
            <ol class="breadcrumb">
                <li><a href="#">Home</a></li>
                <li><a href="#">Content</a></li>
                <li class="active">{$pagetitle}</li>
            </ol>
        </div>

        <!-- Content -->
        <form class="form-horizontal" role="form" action="{:U('Attribute/update')}" method="post">
            <div class="form-group">
                <label class="col-sm-2 control-label">字段名</label>
                <div class="col-sm-4">
                    <input type="text" name="name" value="{$info.name}" class="form-control" />
                </div><span class="help-block">（请输入字段名 英文字母开头，长度不超过30）</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">字段标题</label>
                <div class="col-sm-4">
                    <input type="text" name="title" value="{$info.title}" class="form-control" />
                </div><span class="help-block">（请输入字段标题，用于表单显示）</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">字段类型</label>
                <div class="col-sm-4">
                    <select name="type" id="data-type" class="form-control">
                        <option value="">----请选择----</option>
                        <volist name=":get_attribute_type()" id="type">
                            <option value="{$key}" rule="{$type[1]}" <if condition="$key eq $info['type']"> selected</if>>{$type[0]}</option>
                        </volist>
                    </select>
                </div><span class="help-block">（用于表单中的展示方式）</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">字段定义</label>
                <div class="col-sm-4">
                    <input type="text" name="field" value="{$info.field}" class="form-control" />
                </div><span class="help-block">（字段属性的sql表示）</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">参数</label>
                <div class="col-sm-4">
                    <textarea name="extra" class="form-control" rows="3">{$info.extra}</textarea>
                </div><span class="help-block">（布尔、枚举、多选字段类型的定义数据）</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">默认值</label>
                <div class="col-sm-4">
                    <input type="text" name="value" value="{$info.value}" class="form-control" />
                </div><span class="help-block">（字段的默认值）</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">字段备注</label>
                <div class="col-sm-4">
                    <input type="text" name="remark" value="{$info.remark}" class="form-control" />
                </div><span class="help-block">（用于表单中的提示）</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">字段排序</label>
                <div class="col-sm-4">
                    <input type="text" name="field_sort" value="{$info.field_sort}" class="form-control" />
                </div><span class="help-block">（用于表单中的排序）</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">是否显示</label>
                <div class="col-sm-4">
                    <select name="is_show" class="form-control">
                        <option value="1" <if condition="$info['is_show'] eq 1">selected</if>>始终显示</option>
                        <!--<option value="2" <if condition="$info['is_show'] eq 2">selected</if>>新增显示</option>-->
                        <!--<option value="3" <if condition="$info['is_show'] eq 3">selected</if>>编辑显示</option>-->
                        <option value="0" <if condition="$info['is_show'] eq 0">selected</if>>不显示</option>
                    </select>
                </div><span class="help-block">（是否显示在表单中）</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">是否必填</label>
                <div class="col-sm-4">
                    <select name="is_must" class="form-control">
                        <option value="0" <if condition="$info['is_must'] eq 0">selected</if>>否</option>
                        <option value="1" <if condition="$info['is_must'] eq 1">selected</if>>是</option>
                    </select>
                </div><span class="help-block">（用于自动验证）</span>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <input type="hidden" name="id" value="{$info['id']}"/>
                    <input type="hidden" name="model_id" value="{$info['model_id']}"/>
                    <button type="submit" class="btn btn-primary">提交</button>
                    <button class="btn btn-info" onclick="javascript:history.back(-1);return false;">返 回</button>
                </div>
            </div>
        </form>


    </div>
</div>


<script type="text/javascript" charset="utf-8">

    <eq name="ACTION_NAME" value="add">
            $(function(){
                $('#data-type').change(function(){
                    $('#data-field').val($(this).find('option:selected').attr('rule'));
                });
            })
            </eq>
</script>


</body>
</html>
